<template>
  <div>
    <a-card :bordered="false">
      <f-search-form :more="false" @searchHandler="searchHandler">
        <f-search-form-item label="单号" name="paymentNo" style="width: 250px"/>
        <f-search-form-item label="供货方" name="supplierId" type="select" :data="api.supplier.list" valueKey="supplierId" label-key="supplierName"/>
      </f-search-form>
      <a-tabs @tabClick="tabClick" :defaultActiveKey="current" v-model="current">
        <a-tab-pane tab="待返款" key="form1">
          <refund-no ref="form1" v-if="current=='form1'"></refund-no>
        </a-tab-pane>
        <a-tab-pane tab="已申请返款" key="form5">
          <refund-end ref="form5" v-if="current=='form5'"></refund-end>
        </a-tab-pane>

        <a-tab-pane tab="待退垫付款" key="form2">
          <sbreturn-no ref="form2" v-if="current=='form2'"></sbreturn-no>
        </a-tab-pane>
<!--        <a-tab-pane tab="未办结返款" key="form3">-->
<!--          <refund-yes ref="form3" v-if="current=='form3'"></refund-yes>-->
<!--        </a-tab-pane>-->

        <a-tab-pane tab="已退垫付款" key="form4">
          <sbreturn-yes ref="form4" v-if="current=='form4'"></sbreturn-yes>
        </a-tab-pane>

      </a-tabs>
    </a-card>
  </div>
</template>
<script>

  import api from './../js/api'
  import RefundNo from './tab1'
  import RefundEnd from './tab3'
  import SbreturnNo from '@/views/module/business/order/sbreturn/tab1'
  import SbreturnYes from '@/views/module/business/order/sbreturn/tab2'

  export default {
    name: 'Tabs',
    components: {  SbreturnYes, SbreturnNo, RefundNo, RefundEnd },
    data() {
      let me = this
      return {
        api: Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {},
        current: 'form1',
        forms: [
          'form1',
          'form2',
          'form3'
        ]
      }
    },
    created() {
    },
    methods: {
      tabClick(name) {
        this.current = name
        this.$nextTick(() => {
          this.searchHandler()
        })
      },
      searchHandler(searchParams) {
        if(this.current=='form2')
        {
          this.$refs[this.current].openMultiple(searchParams)
        }
        this.$refs[this.current].searchHandler(searchParams)
      }
    }
  }
</script>
